package src.main.java.org.io;

import java.io.FileWriter;
import java.io.IOException;

/*
* FileWriter
* */
public class Test8 {
    public static void main(String[] args) {
        try (
            FileWriter fileWriter = new FileWriter("E:\\JavaLearn\\javaCode\\src\\test2.txt");
        ) {
            fileWriter.write('a'); //写字符
            fileWriter.write("雷");
            fileWriter.write("我爱你中国");//写字符串
            fileWriter.write("我爱你中国",0,3); //写部分字符串
            fileWriter.write("\r\n"); //换行
            char[] buffer={'我','爱','你','中','国'};
            fileWriter.write(buffer); //写字符数组
            fileWriter.write(buffer,0,2); //写部分字符数组
        }catch(IOException e) {
            e.printStackTrace();
        }

    }
}
